// Copyright (c) 2024 CHANGLEI. All rights reserved.

import 'package:charts_grasp/src/chart/chart_series/series.dart';
import 'package:charts_grasp/src/chart/chart_series/xy_data_series.dart';
import 'package:charts_grasp/src/chart/common/trackball_marker_settings.dart';
import 'package:charts_grasp/src/chart/utils/enum.dart';
import 'package:charts_grasp/src/circular_chart/renderer/circular_series_controller.dart';
import 'package:charts_grasp/src/common/event_args.dart';
import 'package:charts_grasp/src/common/series/chart_series.dart';
import 'package:flutter/material.dart';

typedef ChartTooltipCallback = void Function(TooltipArgs tooltipArgs);

typedef ChartActualRangeChangedCallback = void Function(ActualRangeChangedArgs rangeChangedArgs);

typedef ChartLabelFormatterCallback = ChartAxisLabel Function(AxisLabelRenderDetails axisLabelRenderArgs);

typedef MultiLevelLabelFormatterCallback = ChartAxisLabel Function(
    MultiLevelLabelRenderDetails multiLevelLabelRenderArgs,);

typedef ChartDataLabelRenderCallback = void Function(DataLabelRenderArgs dataLabelArgs);

typedef ChartLegendRenderCallback = void Function(LegendRenderArgs legendRenderArgs);

typedef ChartTrendlineRenderCallback = void Function(TrendlineRenderParams trendlineRenderParams);

typedef ChartTrackballCallback = void Function(TrackballArgs trackballArgs);

typedef ChartCrosshairCallback = void Function(CrosshairRenderArgs crosshairArgs);

typedef ChartZoomingCallback = void Function(ZoomPanArgs zoomingArgs);

typedef ChartPointInteractionCallback = void Function(ChartPointDetails pointInteractionDetails);

typedef ChartAxisLabelTapCallback = void Function(AxisLabelTapArgs axisLabelTapArgs);

typedef ChartLegendTapCallback = void Function(LegendTapArgs legendTapArgs);

typedef ChartSelectionCallback = void Function(SelectionArgs selectionArgs);

typedef ChartTouchInteractionCallback = void Function(ChartTouchInteractionArgs tapArgs);

typedef ChartIndicatorRenderCallback = TechnicalIndicatorRenderDetails Function(
    IndicatorRenderParams indicatorRenderParams,);

typedef ChartMarkerRenderCallback = void Function(MarkerRenderArgs markerArgs);

typedef LoadMoreViewBuilderCallback = Widget Function(BuildContext context, ChartSwipeDirection direction);

typedef ChartPlotAreaSwipeCallback = void Function(ChartSwipeDirection direction);

typedef SeriesRendererCreatedCallback = void Function(ChartSeriesController controller);

typedef ChartDataLabelTemplateBuilder<T> = Widget Function(T data, CartesianChartPoint<dynamic> point, int pointIndex,
    {int seriesIndex, CartesianSeries<dynamic, dynamic> series,});

typedef DataLabelTapCallback = void Function(DataLabelTapDetails onTapArgs);

typedef LegendItemBuilder = Widget Function(String legendText, dynamic series, dynamic point, int seriesIndex);

typedef ChartIndexedValueMapper<R> = R? Function(int index);

typedef ChartValueMapper<T, R> = R? Function(T datum, int index);

typedef ChartShaderMapper<T> = Shader Function(T datum, int index, Color color, Rect rect);

typedef ChartWidgetBuilder<T> = Widget Function(
    dynamic data, dynamic point, dynamic series, int pointIndex, int seriesIndex,);

typedef ChartTrackballBuilder<T> = Widget Function(BuildContext context, TrackballDetails trackballDetails);

typedef ChartSeriesRendererFactory<T, D> = ChartSeriesRenderer Function(ChartSeries<T, D> series);

typedef CircularLegendRenderCallback = void Function(LegendRenderArgs legendRenderArgs);

typedef CircularTooltipCallback = void Function(TooltipArgs tooltipArgs);

typedef CircularDatalabelRenderCallback = void Function(DataLabelRenderArgs dataLabelArgs);

typedef CircularSelectionCallback = void Function(SelectionArgs selectionArgs);

typedef CircularTouchInteractionCallback = void Function(ChartTouchInteractionArgs tapArgs);

typedef CircularShaderCallback = Shader Function(ChartShaderDetails chartShaderDetails);

typedef CircularSeriesRendererCreatedCallback = void Function(CircularSeriesController controller);

typedef ChartErrorBarRenderCallback = void Function(ErrorBarRenderDetails errorBarRenderDetails);

typedef CartesianShaderCallback = Shader Function(ShaderDetails shaderDetails);
